<p>A relation is similar to a <a href="#root/_help_HI6GBBIduIgv">label</a>,
  but instead of having a text value it refers to another note.</p>
<h2>Common use cases</h2>
<ul>
  <li><strong>Metadata Relationships for personal use</strong>: For example,
    linking a book note to an author note.
    <br>This can be combined with&nbsp;<a class="reference-link" href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>&nbsp;to
    make their display more user-friendly.</li>
  <li><strong>Configuration</strong>: For configuring some notes such as&nbsp;
    <a
    class="reference-link" href="#root/_help_HcABDtFCkbFN">Render Note</a>, or configuring&nbsp;<a class="reference-link" href="#root/_help_R9pX4DGra2Vt">Sharing</a>&nbsp;or&nbsp;
      <a
      class="reference-link" href="#root/_help_KC1HB96bqqHX">Templates</a>&nbsp;(see the list below).</li>
  <li><strong>Scripting</strong>: Attaching scripts to events or conditions
    related to the note.</li>
</ul>
<h2>Creating a relation using the visual editor</h2>
<ol>
  <li>Go to the <em>Owned Attributes</em> section in the&nbsp;<a class="reference-link"
    href="#root/_help_BlN9DFI679QC">Ribbon</a>.</li>
  <li>Press the + button (<em>Add new attribute</em>) to the right.</li>
  <li>Select <em>Add new relation</em> for the relation.</li>
</ol>
<aside class="admonition tip">
  <p>If you prefer keyboard shortcuts, press <kbd>Alt</kbd>+<kbd>L</kbd> while
    focused on a note or in the <em>Owned Attributes</em> section to display
    the visual editor.</p>
</aside>
<p>While in the visual editor:</p>
<ul>
  <li>Set the desired name</li>
  <li>Set the Target note (the note to point to). Unlike labels, relations cannot
    exist with a target note.</li>
  <li>Check <em>Inheritable</em> if the label should be inherited by the child
    notes as well. See&nbsp;<a class="reference-link" href="#root/_help_bwZpz2ajCEwO">Attribute Inheritance</a>&nbsp;for
    more information.</li>
</ul>
<h2>Creating a relation manually</h2>
<p>In the <em>Owned Attributes</em> section in the&nbsp;<a class="reference-link"
  href="#root/_help_BlN9DFI679QC">Ribbon</a>:</p>
<ul>
  <li>To create a relation called <code>myRelation</code>:
    <ul>
      <li>First type <code>~myRelation=@</code> .</li>
      <li>After this, an autocompletion box should appear.</li>
      <li>Type the title of the note to point to and press <kbd>Enter</kbd> to confirm
        (or click the desired note).</li>
      <li>Alternatively copy a note from the&nbsp;<a class="reference-link" href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>&nbsp;and
        paste it after the <code>=</code> sign (without the <code>@</code> , in this
        case).</li>
    </ul>
  </li>
  <li>To create an inheritable relation, follow the same steps as previously
    described but instead of <code>~myRelation</code> write <code>~myRelation(inheritable)</code>.</li>
</ul>
<h2>Predefined relations</h2>
<p>These relations are supported and used internally by Trilium.</p>
<aside
class="admonition tip">
  <p>Some relations presented here end with a <code>*</code>. That means that
    there are multiple relations with the same prefix, consult the specific
    page linked in the description of that relation for more information.</p>
  </aside>
  <table>
    <thead>
      <tr>
        <th>Label</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><code>runOn*</code>
        </td>
        <td>See&nbsp;<a class="reference-link" href="#root/_help_GPERMystNGTB">Events</a>
        </td>
      </tr>
      <tr>
        <td><code>template</code>
        </td>
        <td>note's attributes will be inherited even without a parent-child relationship,
          note's content and subtree will be added to instance notes if empty. See
          documentation for details.</td>
      </tr>
      <tr>
        <td><code>inherit</code>
        </td>
        <td>note's attributes will be inherited even without a parent-child relationship.
          See&nbsp;<a class="reference-link" href="#root/_help_KC1HB96bqqHX">Templates</a>&nbsp;for
          a similar concept. See&nbsp;<a class="reference-link" href="#root/_help_bwZpz2ajCEwO">Attribute Inheritance</a>&nbsp;in
          the documentation.</td>
      </tr>
      <tr>
        <td><code>renderNote</code>
        </td>
        <td>notes of type&nbsp;<a class="reference-link" href="#root/_help_HcABDtFCkbFN">Render Note</a>&nbsp;will
          be rendered using a code note (HTML or script) and it is necessary to point
          using this relation to which note should be rendered</td>
      </tr>
      <tr>
        <td><code>widget_relation</code>
        </td>
        <td>target of this relation will be executed and rendered as a widget in the
          sidebar</td>
      </tr>
      <tr>
        <td><code>shareCss</code>
        </td>
        <td>CSS note which will be injected into the share page. CSS note must be
          in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code> and <code>share_omit_default_css</code> as
          well.</td>
      </tr>
      <tr>
        <td><code>shareJs</code>
        </td>
        <td>JavaScript note which will be injected into the share page. JS note must
          be in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code>.</td>
      </tr>
      <tr>
        <td><code>shareHtml</code>
        </td>
        <td>HTML note which will be injected into the share page at locations specified
          by the <code>shareHtmlLocation</code> label. HTML note must be in the shared
          sub-tree as well. Consider using <code>share_hidden_from_tree</code>.</td>
      </tr>
      <tr>
        <td><code>shareTemplate</code>
        </td>
        <td>Embedded JavaScript note that will be used as the template for displaying
          the shared note. Falls back to the default template. Consider using <code>share_hidden_from_tree</code>.</td>
      </tr>
      <tr>
        <td><code>shareFavicon</code>
        </td>
        <td>Favicon note to be set in the shared page. Typically you want to set it
          to share root and make it inheritable. Favicon note must be in the shared
          sub-tree as well. Consider using <code>share_hidden_from_tree</code>.</td>
      </tr>
    </tbody>
  </table>